< previous page page_174 next page >

Page 174
Chapter Objectives
Learn about event procedures and user-defined procedures
Learn to view all procedures in a project
Learn about code modules or BAS files
Learn how to pass arguments to a procedure or function
Learn to use optional parameters
Learn about named arguments
Learn to declare and return data from a function
Learn about function and procedure naming standards
Sample Project File: \Chapter09\Procedures.vbp
Procedures
Procedures are bits of code that can be used to respond to events, or you can write general procedures that can perform some action. Procedures do not return values to the calling routine. Procedures are identified by the keyword Sub in their declaration.
Naming Procedures
You must follow certain rules when naming variables, procedures, and functions. All procedures and functions must begin with a letter. After the first letter, they may contain an combination of letters, numbers, and underscore characters. No other characters are allowed. Procedure names may be up to 255 characters long.
Event/Subprocedures
Event procedures are always declared with the keyword Sub, which stands for subroutine. A subroutine is a set of statements executed by calling a name where these statements are stored. No value is returned from a subprocedure. The difference between an event procedure and any other subprocedure is that Visual Basic defines the name of the event procedure and what arguments are passed into the procedure. Your own procedures you can name whatever you want and pass any arguments you want.

 
< previous page page_174 next page >

If you like this book, buy it!